#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

bool is_prime(int n) {
    if (n < 2) {
        return false;
    }
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

int main() {
    std::vector<std::string> word_to_num = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
    std::string input;
    std::cout << "Enter three word: ";
    std::getline(std::cin, input);
    std::vector<std::string> words;
    std::string word;
    for (char c : input) {
        if (c == ' ') {
            if (!word.empty()) {
                words.push_back(word);
                word.clear();
            }
        } else {
            word += c;
        }
    }
    if (!word.empty()) {
        words.push_back(word);
    }

    if (words.size() != 3) {
        std::cout << "Wrong input" << std::endl;
        return 0;
    }

    int num = 0;
    for (const std::string& word : words) {
        auto it = std::find(word_to_num.begin(), word_to_num.end(), word);
        if (it == word_to_num.end()) {
            std::cout << "Wrong input" << std::endl;
            return 0;
        }
        num = num * 10 + std::distance(word_to_num.begin(), it);
    }
    cout << num;
}
